package entidades;

/**
 * @author Paulo -> 42243
 * @author Daniela -> 42439
 *
 */

import java.util.concurrent.Semaphore;

public class Ilha {
	
	private Gruta[] grutas;
	private Semaphore atracado;
	
	public Ilha(int numGrutas) {
		this.grutas = new Gruta[numGrutas];
		
		for (int i=0; i<numGrutas; i++)
			this.grutas[i] = new Gruta((i+1));
		
		this.atracado = new Semaphore(1);
	}
	
	public void acquire() throws InterruptedException {
		this.atracado.acquire();
	}
	
	public void release() {
		this.atracado.release();
	}
	
	public Gruta[] getGrutas() {
		return grutas;
	}
}
